/*
 Shake action code by Francois Guibert
 Contact: www.frozax.com - http://twitter.com/frozax - www.facebook.com/frozax
 */

#ifndef UG_SHAKE_H
#define UG_SHAKE_H

#include "cocos2d.h"

USING_NS_CC;

namespace ugame {
    class UGShake : public ActionInterval {
    public:
        UGShake();
        
        // Create the action with a time and a strength (same in x and y)
        static UGShake* actionWithDuration(float d, float strength);
        // Create the action with a time and strengths (different in x and y)
        static UGShake* actionWithDuration(float d, float strength_x, float strength_y);
        bool initWithDuration(float d, float strength_x, float strength_y);
        
        virtual void startWithTarget(Node *pTarget);
        virtual void update(float time);
        virtual void stop(void);
        
        
        protected:
        // Initial position of the shaked node
        float _initial_x, _initial_y;
        // Strength of the action
        float _strength_x, _strength_y;
    };
}

#endif
